{extend name='index/base' /}

{block name='main'}
<body>
<style>

    .searchable-select-dropdown{z-index:999;}

</style>
<link rel="stylesheet" type="text/css" href="/static/admin/select/jquery.searchableSelect.css" />
<article class="page-container">
    <form action="{:url('admin/User/doedit')}" method="post" class="form form-horizontal" id="form-member-add" enctype="multipart/form-data">
        <!--<div class="row cl">-->
        <!--<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>账户类型：</label>-->
        <!--<div class="formControls col-xs-8 col-sm-9"> <span class="select-box">-->
        <!--<select class="select" size="1" name="">-->
        <!--<option value="" selected>请选择类型</option>-->
        <!--<option value="1">企业会员</option>-->
        <!--</select>-->
        <!--</span>-->
        <!--</div>-->
        <!--</div>-->
        <input type="hidden" name="id" value="{$data.id}">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>所属企业：</label>
            <div class="formControls col-xs-8 col-sm-9"> <span class="">
				<select class="select" id="vip" size="1" name="vid">
					<option value="" selected>请选择企业：</option>
                    {volist name='list' id='user'}
                    <option value="{$user.id}" {if condition="$user.id==$data.vid"}selected {/if}>{$user.name}</option>
                    {/volist}
				</select>
				</span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>所属代理商：</label>
            <div class="formControls col-xs-8 col-sm-9"> <span class="">
				<select class="select" id="agent" size="1" name="aid">
					<option value="" selected>请选择代理商：</option>
                    {volist name='agents' id='user'}
                    <option value="{$user.id}" {if condition="$user.id==$data.aid"}selected {/if}>{$user.name}</option>
                    {/volist}
				</select>
				</span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>直播间：</label>
            <div class="formControls col-xs-8 col-sm-9"> <span class="">
				<select class="select" id="zbj" size="1" name="refereecode">
                    <option value="1" >否</option>
                    <option value="0" {if condition="0===$data.refereecode"}selected {/if}>是</option>
				</select>
				</span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>客户姓名：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$data.name}" placeholder="" name="name">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>手机号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$data.phonenumber}" placeholder="" name="phonenumber">
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>
</body>
</html>
{/block}


{block name='my'}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/static/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="/static/admin/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="/static/admin/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="/static/admin/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="/static/admin/select/jquery.searchableSelect.js"></script>
<script type="text/javascript">
    $(function(){
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        // $("#form-member-add").validate({
        // 	rules:{
        // 		username:{
        // 			required:true,
        // 			minlength:2,
        // 			maxlength:16
        // 		},
        // 		sex:{
        // 			required:true,
        // 		},
        // 		mobile:{
        // 			required:true,
        // 			isMobile:true,
        // 		},
        // 		uploadfile:{
        // 			required:true,
        // 		},
        //
        // 	},
        // 	onkeyup:false,
        // 	focusCleanup:true,
        // 	success:"valid",
        // 	submitHandler:function(form){
        // 		//$(form).ajaxSubmit();
        // 		var index = parent.layer.getFrameIndex(window.name);
        // 		//parent.$('.btn-refresh').click();
        // 		parent.layer.close(index);
        // 	}
        // });
    });
</script>
<!--/请在上方写此页面业务相关的脚本-->
<script>
    function myclose() {
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
//        $(".layui-layer-shade").hide();
//        $(".layer-anim").hide();
    }
    //

    $('#vip').searchableSelect({
        afterSelectItem: function(){
//            alert(111);
            $id=this.holder.data("value");
            $agent='{$data.aid}';
            $.ajax({
                type:'get',
                url:'/admin/User/selectagent?id='+$id,
                dataType:'json',
                success:function (data) {
                    $('#agent').empty();
                    $obj='<option value="" selected>所有</option>';
                    for(var i in data){
                        if(data[i].id==$agent){
                            $temp='selected';
                        }else{
                            $temp='';
                        }
                        $obj=$obj+'<option value="'+data[i].id+'"'+$temp+' >'+data[i].name+'</option>';
                    }
                    $('#agent').append($obj);
                    $('#agent').next('div').remove();
                    $('#agent').searchableSelect();
                },
                error:function () {
                    console.log('ajax操作失败');
                }
            })
        }
    });
    $('#agent').searchableSelect();
    $('#zbj').searchableSelect();
</script>


{/block}

